package check;

import statemap.FSMContext;
import statemap.State;
import statemap.StateUndefinedException;

public class AppClassContext extends FSMContext {

	private static final long serialVersionUID = 1L;

	public AppClassContext(AppClass owner) {
		super(Map1.Start);
		_owner = owner;
	}

	public AppClassContext(AppClass owner, AppClassState initState) {
		super(initState);
		_owner = owner;
	}

	public void enterStartState() {
		getState().Entry(this);
		return;
	}

	public void EOS() {
		_transition = "EOS";
		getState().EOS(this);
		_transition = "";
		return;
	}

	public void One() {
		_transition = "One";
		getState().One(this);
		_transition = "";
		return;
	}

	public void Unknown() {
		_transition = "Unknown";
		getState().Unknown(this);
		_transition = "";
		return;
	}

	public void Zero() {
		_transition = "Zero";
		getState().Zero(this);
		_transition = "";
		return;
	}

	public AppClassState getState() throws StateUndefinedException {
		if (_state == null) {
			throw (new statemap.StateUndefinedException());
		}
		return ((AppClassState) _state);
	}

	protected AppClass getOwner() {
		return (_owner);
	}

	public void setOwner(AppClass owner) {
		if (owner == null) {
			throw (new NullPointerException("null owner"));
		} else {
			_owner = owner;
		}
		return;
	}

	transient private AppClass _owner;

	public static abstract class AppClassState extends State {

		private static final long serialVersionUID = 1L;

		protected AppClassState(String name, int id) {
			super(name, id);
		}

		protected void Entry(AppClassContext context) {
		}

		protected void Exit(AppClassContext context) {
		}

		protected void EOS(AppClassContext context) {
			Default(context);
		}

		protected void One(AppClassContext context) {
			Default(context);
		}

		protected void Unknown(AppClassContext context) {
			Default(context);
		}

		protected void Zero(AppClassContext context) {
			Default(context);
		}

		protected void Default(AppClassContext context) {
			throw (new statemap.TransitionUndefinedException("State: "
					+ context.getState().getName() + ", Transition: "
					+ context.getTransition()));
		}
	}

	static abstract class Map1 {
		public static final Map1_Start Start = new Map1_Start("Map1.Start", 0);
		public static final Map1_Zeros Zeros = new Map1_Zeros("Map1.Zeros", 1);
		public static final Map1_Ones Ones = new Map1_Ones("Map1.Ones", 2);
		public static final Map1_OK OK = new Map1_OK("Map1.OK", 3);
		public static final Map1_Error Error = new Map1_Error("Map1.Error", 4);
		private static final Map1_Default Default = new Map1_Default(
				"Map1.Default", -1);

		public static Map1_Start getStart() {
			return Start;
		}

		public static Map1_Zeros getZeros() {
			return Zeros;
		}

		public static Map1_Ones getOnes() {
			return Ones;
		}

		public static Map1_OK getOk() {
			return OK;
		}

		public static Map1_Error getError() {
			return Error;
		}

		public static Map1_Default getDefault() {
			return Default;
		}

	}

	protected static class Map1_Default extends AppClassState {

		private static final long serialVersionUID = 1L;

		protected Map1_Default(String name, int id) {
			super(name, id);
		}

		protected void Unknown(AppClassContext context) {
			(context.getState()).Exit(context);
			context.setState(Map1.Error);
			(context.getState()).Entry(context);
			return;
		}
	}

	private static final class Map1_Start extends Map1_Default {

		private static final long serialVersionUID = 1L;

		private Map1_Start(String name, int id) {
			super(name, id);
		}

		protected void EOS(AppClassContext context) {
			AppClass ctxt = context.getOwner();
			(context.getState()).Exit(context);
			context.clearState();
			try {
				ctxt.Acceptable();
			} finally {
				context.setState(Map1.OK);
				(context.getState()).Entry(context);
			}
			return;
		}

		protected void One(AppClassContext context) {
			(context.getState()).Exit(context);
			context.setState(Map1.Ones);
			(context.getState()).Entry(context);
			return;
		}

		protected void Zero(AppClassContext context) {
			(context.getState()).Exit(context);
			context.setState(Map1.Zeros);
			(context.getState()).Entry(context);
			return;
		}
	}

	private static final class Map1_Zeros extends Map1_Default {

		private static final long serialVersionUID = 1L;

		private Map1_Zeros(String name, int id) {
			super(name, id);
		}

		protected void EOS(AppClassContext context) {
			AppClass ctxt = context.getOwner();
			(context.getState()).Exit(context);
			context.clearState();
			try {
				ctxt.Acceptable();
			} finally {
				context.setState(Map1.OK);
				(context.getState()).Entry(context);
			}
			return;
		}

		protected void One(AppClassContext context) {
			(context.getState()).Exit(context);
			context.setState(Map1.Ones);
			(context.getState()).Entry(context);
			return;
		}

		protected void Zero(AppClassContext context) {
			return;
		}
	}

	private static final class Map1_Ones extends Map1_Default {

		private static final long serialVersionUID = 1L;

		private Map1_Ones(String name, int id) {
			super(name, id);
		}

		protected void EOS(AppClassContext context) {
			AppClass ctxt = context.getOwner();
			(context.getState()).Exit(context);
			context.clearState();
			try {
				ctxt.Acceptable();
			} finally {
				context.setState(Map1.OK);
				(context.getState()).Entry(context);
			}
			return;
		}

		protected void One(AppClassContext context) {
			return;
		}

		protected void Zero(AppClassContext context) {
			(context.getState()).Exit(context);
			context.setState(Map1.Error);
			(context.getState()).Entry(context);
			return;
		}
	}

	private static final class Map1_OK extends Map1_Default {

		private static final long serialVersionUID = 1L;

		private Map1_OK(String name, int id) {
			super(name, id);
		}
	}

	private static final class Map1_Error extends Map1_Default {

		private static final long serialVersionUID = 1L;

		private Map1_Error(String name, int id) {
			super(name, id);
		}

		protected void EOS(AppClassContext context) {
			AppClass ctxt = context.getOwner();
			AppClassState endState = context.getState();
			context.clearState();
			try {
				ctxt.Unacceptable();
			} finally {
				context.setState(endState);
			}
			return;
		}

		protected void One(AppClassContext context) {
			return;
		}

		protected void Unknown(AppClassContext context) {
			return;
		}

		protected void Zero(AppClassContext context) {
			return;
		}
	}
}